from utils.api import API
from django.conf.urls import url
from software.forms import *
from software.views import view_develop, view_software, views_dataAdmin, views_dataInfo, view_group, view_container

baseUrl = "/api/software/"

uploadSoftAPI = API(UploadSoftForm, method='POST', moduleUrl='upload/', urlPrefix=baseUrl)
uploadFilesAPI = API(UploadForm, method='POST', moduleUrl='upfile/', urlPrefix=baseUrl)
softDetailAPI = API(SoftDetailForm, method='POST', moduleUrl='detail/', urlPrefix=baseUrl)
softwareListAPI = API(SoftwareListForm, method='POST', moduleUrl='list/', urlPrefix=baseUrl)
softOperationAPI = API(SoftOperationForm, method='POST', moduleUrl='operate/', urlPrefix=baseUrl)
softSearchAPI = API(SoftSearchForm, method='POST', moduleUrl='research/', urlPrefix=baseUrl)
groupListAPI = API(GroupListForm, method='POST', moduleUrl='groupList/', urlPrefix=baseUrl)
groupSearchAPI = API(GroupSearchForm, method='POST', moduleUrl='groupScreen/', urlPrefix=baseUrl)
groupDetailAPI = API(GroupDetailForm, method='POST', moduleUrl='groupDetail/', urlPrefix=baseUrl)
groupOperateAPI = API(GroupOperateForm, method='POST', moduleUrl='groupOperate/', urlPrefix=baseUrl)
groupServiceOperateAPI = API(GroupServiceOperateForm, method='POST', moduleUrl='groupServiceOperate/',
                             urlPrefix=baseUrl)
groupDownLoadAPI = API(GroupDownLoadForm, method='POST', moduleUrl='groupDownload/', urlPrefix=baseUrl)

getStorehouseListAPI = API(GetStorehouseListForm, method='POST', moduleUrl='depository/', urlPrefix=baseUrl)
dataOperationAPI = API(DataOperationForm, method='POST', moduleUrl='data/handle/', urlPrefix=baseUrl)
dataCheckAPI = API(DataCheckForm, method='POST', moduleUrl='data/check/', urlPrefix=baseUrl)
getDataListAPI = API(GetDataListForm, method='POST', moduleUrl='material/', urlPrefix=baseUrl)
dataScreenAPI = API(DataScreenForm, method='POST', moduleUrl='data/screen/', urlPrefix=baseUrl)
getTypeListAPI = API(GetTypeListForm, method='POST', moduleUrl='softwaretype/', urlPrefix=baseUrl)
dataUpdateAPI = API(DataUpdateForm, method='POST', moduleUrl='data/update/', urlPrefix=baseUrl)
getTypeAPI = API(GetTypeForm, method='POST', moduleUrl='typeList/', urlPrefix=baseUrl)
softwareTypeOptionAPI = API(SoftwareTypeOptionForm, method='POST', moduleUrl='typeOption/', urlPrefix=baseUrl)
detailGetAPI = API(DetailGetForm, method='POST', moduleUrl='softUpdate/', urlPrefix=baseUrl)
qaGetAPI = API(QaGetForm, method='POST', moduleUrl='requestQA/', urlPrefix=baseUrl)
deleteAPI = API(DelteForm, method='POST', moduleUrl='deleteFile/', urlPrefix=baseUrl)
getHashAPI = API(GetHashForm, method='POST', moduleUrl='hash/', urlPrefix=baseUrl)
# 断点续传
indexAPI = API(EmptyPass, method='POST', moduleUrl='index/', urlPrefix=baseUrl)
checkChunkAPI = API(EmptyPass, method='POST', moduleUrl='checkChunk/', urlPrefix=baseUrl)
mergeChunksAPI = API(EmptyPass, method='POST', moduleUrl='mergeChunks/', urlPrefix=baseUrl)
uploadNewAPI = API(EmptyPass, method='POST', moduleUrl='uploadNew/', urlPrefix=baseUrl)

uploadChunkAPI = API(ChunkForm, method='POST', moduleUrl='upSoftFile/', urlPrefix=baseUrl)
getDuanInfoAPI = API(GetDuanInfoForm, method='POST', moduleUrl='duanInfo/', urlPrefix=baseUrl)
getDuanInfoServerAPI = API(GetDuanInfoServerForm, method='GET', moduleUrl='duanInfoServer/', urlPrefix=baseUrl)
pushDuanToOtherAPI = API(PushDuanToOtherForm, method='POST', moduleUrl='pushDuanFile/', urlPrefix=baseUrl)
getPushListAPI = API(GetPushListForm, method='POST', moduleUrl='getPushList/', urlPrefix=baseUrl)
getPushStateAPI = API(GetPushStateForm, method='POST', moduleUrl='getPushState/', urlPrefix=baseUrl)
containerListAPI = API(ContainerListForm, method='POST', moduleUrl='containerList/', urlPrefix=baseUrl)
#test
saveAPI= API(saveForm, method='POST', moduleUrl='save/', urlPrefix=baseUrl)

urlpatterns = [
    url(uploadSoftAPI.moduleUrl, view_develop.uploadSoft),
    url(uploadFilesAPI.moduleUrl, view_develop.uploadfiles),
    url(softDetailAPI.moduleUrl, view_software.softDetail),
    url(softwareListAPI.moduleUrl, view_software.softwarelist),
    url(softOperationAPI.moduleUrl, view_software.softOperation),
    url(softSearchAPI.moduleUrl, view_software.softSearch),

    url(dataOperationAPI.moduleUrl, views_dataAdmin.dataOperation),
    url(dataCheckAPI.moduleUrl, views_dataAdmin.dataCheck),
    url(getDataListAPI.moduleUrl, views_dataInfo.getDataList),
    url(dataScreenAPI.moduleUrl, views_dataInfo.dataScreen),
    url(getStorehouseListAPI.moduleUrl, views_dataInfo.getStorehouseList),
    url(getTypeListAPI.moduleUrl, views_dataAdmin.getTypeList),
    url(dataUpdateAPI.moduleUrl, views_dataAdmin.dataUpdate),
    url(getTypeAPI.moduleUrl, views_dataInfo.getType),
    url(softwareTypeOptionAPI.moduleUrl, views_dataInfo.softwareTypeOption),
    url(detailGetAPI.moduleUrl, view_software.detailGet),
    url(qaGetAPI.moduleUrl, view_software.requestQA),
    url(deleteAPI.moduleUrl, views_dataAdmin.deleteFile),
    url(getHashAPI.moduleUrl, view_software.getHash),

    url(groupListAPI.moduleUrl, view_group.groupList),
    url(groupSearchAPI.moduleUrl, view_group.groupSearch),
    url(groupDetailAPI.moduleUrl, view_group.groupDetail),
    url(groupOperateAPI.moduleUrl, view_group.groupOperate),
    url(groupServiceOperateAPI.moduleUrl, view_group.groupServiceOperate),
    url(groupDownLoadAPI.moduleUrl, view_group.groupDownLoad),

    # upload
    url(indexAPI.moduleUrl, view_develop.index),
    url(checkChunkAPI.moduleUrl, view_develop.checkChunk),
    url(mergeChunksAPI.moduleUrl, view_develop.mergeChunks),
    url(uploadNewAPI.moduleUrl, view_develop.uploadNew),

    url(uploadChunkAPI.moduleUrl, view_develop.uploadChunk),
    url(getDuanInfoAPI.moduleUrl, view_software.getDuanInfo),
    url(getDuanInfoServerAPI.moduleUrl, view_software.getDuanInfoServer),
    url(pushDuanToOtherAPI.moduleUrl, view_software.pushDuanToOther),
    url(getPushListAPI.moduleUrl, view_software.getPushList),
    url(getPushStateAPI.moduleUrl, view_software.getPushState),
    url(containerListAPI.moduleUrl, view_container.containerList),
    #test
    url(saveAPI.moduleUrl, view_software.save),
]
